from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class rename_menu_fake :
    def __init__ ( self ) :
        self . _show_rename_menu = False
        self . _hide_rename_menu = False
        self . _on_browser_return = False
        self . _on_browser_action = False
    def show_rename_menu ( self ) :
        self . _show_rename_menu = True
    def hide_rename_menu ( self ) :
        self . _hide_rename_menu = True
    def on_browser_return ( self ) :
        self . _on_browser_return = True
    def on_browser_action ( self ) :
        self . _on_browser_action = True

class arbitrary_module_fake :
    def on_browser_action ( self ) :
        pass
    def on_browser_return ( self ) :
        pass

class mediator_rename_menu_tests : 
    'mediator_rename_menu'
    def __init__ ( self , test ) :
        self . _test = test
        self . _rename_menu = rename_menu_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'rename_menu' 
            , self . _rename_menu
            , arbitrary_module_fake
            ) )
    def test_show_rename_menu ( self ) :
        self . _mediator . show_rename_menu ( )
        self . _test . assume_true ( self . _rename_menu . _show_rename_menu )
    def test_hide_rename_menu ( self ) :
        self . _mediator . hide_rename_menu ( )
        self . _test . assume_true ( self . _rename_menu . _hide_rename_menu )
    def test_on_browser_return ( self ) :
        self . _mediator . on_browser_return ( )
        self . _test . assume_true ( self . _rename_menu . _on_browser_return )
    def test_on_browser_action ( self ) :
        self . _mediator . on_browser_action ( )
        self . _test . assume_true ( self . _rename_menu . _on_browser_action )
